from datetime import date
from task import Task, TaskDB

def render_tasks_for_day(day = date.today()):
  tdb = TaskDB()
  tasks = tdb.get_tasks_for_day(day)
  return "<div class=\"tasks\">\n" +\
      "\n".join(('''  <div class="task">
    <div class="date">%s</div>
    <div class="subj">%s</div>
    <div class="hw">%s</div>
  </div>
''' % (x.date.strftime("%d.%m.%Y"), x.subject, x.text))\
  for x in tasks)  + "</div>"

def render_tasks_for_week(day = date.today()):
  tdb = TaskDB()
  tasks = tdb.get_tasks_for_cal_week(day)
  return "<div class=\"tasks\">\n" +\
      "\n".join(('''  <div class="task">
    <div class="date">%s</div>
    <div class="subj">%s</div>
    <div class="hw">%s</div>
  </div>
''' % (x.date.strftime("%d.%m.%Y"), x.subject, x.text))\
  for x in tasks) + "</div>"



#class TaskDB():
#  def get_tasks_for_day(self, day):
#    return(Task(date.today(), "subj", "text"), Task(date.today(), "subj2", "text2"))
#  def get_tasks_for_cal_week(self, day):
#    return(Task(date.today(), "subj", "text"), Task(date.today(), "subj2", "text2"), Task(date.today(), "subj3", "text3"))
#
#
#class Task():
#  def __init__(self, date, subject, text):
#    self.date, self.subject, self.text =  date, subject, text
